<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateInvoiceHistoryBusinessRel extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('invoice_history_business_rel', function (Blueprint $table) {
            $table->id();

            $table->unsignedBigInteger("invoiceHistoryId")->default(0)->comment("开票记录id");
            $table->string("invoiceTotalAmount")->default("")->comment("业务开票总金额");
            $table->string("businessId")->default("")->comment("业务标识id");
            $table->unsignedBigInteger("businessOrderTime")->default(0)->comment("对应业务下单时间");

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '开票业务关联表';

            $table->index(['invoiceHistoryId'], 'idx_invoiceHistoryId');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('invoice_history_business_rel');
    }
}
